package com.xl.generator.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xl.generator.common.ActionResult;
import com.xl.generator.common.ActionResultService;
import com.xl.generator.domain.Menu;
import com.xl.generator.pojo.PageList;
import com.xl.generator.service.MenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 〈〉<br>
 *
 * @author lvln5
 * @Description
 * @date 2022/11/12 19:39
 */
@Api(value = "菜单的增删改查")
@RestController
@RequestMapping("menu")
public class MenuController {

	@Resource
	private MenuService menuService;

	@ApiOperation(value = "分页查询所有菜单", notes="")
	@PostMapping ("list")
	public ActionResult test(@RequestParam("current") Integer current,@RequestParam("Size") Integer size){
		IPage<Menu> choiceQuestion = new Page<>();
		choiceQuestion.setCurrent(current);
		choiceQuestion.setSize(size);
		IPage<Menu> page = menuService.page(choiceQuestion);
		PageList pageList = new PageList();
		pageList.setTotal(choiceQuestion.getTotal());
		pageList.setData(page);
		return ActionResultService.callBackResultOK(pageList);
	}
}
